i = 1
while i <= 100:
    if (i % 7 == 0 and i % 8 == 0):
        print("{}".format(i))
    i = i + 1

i = 1
sum = 0
while i <= 200:
    sum = sum + i
    i = i + 1
print("{}".format(sum))

i = 100
while i < 1000:
    a = i % 10
    b = i // 10 % 10
    c = i // 100
    if a ** 3 + b ** 3 + c ** 3 == i:
        print("{}".format(i))
    i = i + 1

i = 1000
while i < 10000:
    a = i % 10
    b = i // 10 % 10
    c = i // 100 % 10
    d = i // 1000
    if a ** 4 + b ** 4 + c ** 4 + d ** 4 == i:
        print("{}".format(i))
    i = i + 1

i = 1
sum = 0
while i <= 100:
    if i % 2 == 0:
        sum = sum + i
    i = i + 1
print("{}".format(sum))

i = 10000
sum = 0
while i < 100000:
    a = i % 10  # 个位数
    b = i // 10 % 10  # 十位数
    c = i // 100 % 10  # 百位数
    d = i // 1000 % 10  # 千位数
    e = i // 10000  # 万位数
    if a ** 5 + b ** 5 + c ** 5 + d ** 5 + e ** 5 == i:
        sum = sum + i
        print("{}".format(i))
    i = i + 1
print("{}".format(sum))

i = 1567
a = i % 10
b = i // 10 % 10
c = i // 100 % 10
d = i // 1000
print(a, b, c, d)


def isNarcissisticNumber(a):
    if a >= 10:
        list = []
        digit = len(str(a))
        # print(digit)
        a1 = 0
        b1 = 0
        temp = 10
        for i in range(digit):
            if i == 0:
                a1 = a % 10
            elif i == digit - 1:
                b1 = 10 ** (digit - 1)
            else:
                c = a // temp % 10
                temp = temp * 10
                list.append(c)
        # print(list)
        mid = 0
        for x in list:
            mid = mid + x ** digit
        # print("result = " + str(int(a1 ** digit) + int(mid) + int((a // b1) ** digit)))

        if int(a1 ** digit + int(mid) + int((a // b1) ** digit)) == int(a):
            print("是自幂数")
        else:
            print("不是自幂数")
    else:
        print("请输入大于10的数")


# isNarcissisticNumber(548834)
isNarcissisticNumber(int(input("请输入一个数字,判断是不是自幂数")))